﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
    /* http://localhost:8080/Xiaomi/  */
%>
<html>
<head>
    <link rel="icon" href="../img/logo.jpg">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>欢迎登录小米后台管理系统</title>
    <link href="<%=basePath %>admin/css/style.css" rel="stylesheet" type="text/css"/>
    <script language="JavaScript" src="<%=basePath %>admin/js/jquery.js"></script>
    <script src="<%=basePath %>admin/js/cloud.js" type="text/javascript"></script>

    <script language="javascript">
        if (window.top != window.self) {
            window.top.location = window.self.location;
        }
        $(function () {
            $('.loginbox').css({'position': 'absolute', 'left': ($(window).width() - 692) / 2});
            $(window).resize(function () {
                $('.loginbox').css({'position': 'absolute', 'left': ($(window).width() - 692) / 2});
            })
        });
    </script>

</head>

<body style="background-color:#1c77ac; background-image:url(images/light.png); background-repeat:no-repeat; background-position:center top; overflow:hidden;">
<div id="mainBody">
    <div id="cloud1" class="cloud"></div>
    <div id="cloud2" class="cloud"></div>
</div>


<div class="logintop">
    <span>欢迎登录后台管理界面平台</span>
    <ul>
        <li><a href="#">回首页</a></li>
        <li><a href="#">帮助</a></li>
        <li><a href="#">关于</a></li>
    </ul>
</div>

<div class="loginbody">

    <span class="systemlogo"></span>

    <div class="loginbox">
        <%--    <form action="<%=basePath%>admin/login" method="post">--%>
        <form>
            <input name="func" type="hidden" value="adminLogin"/>
            <ul>
                <li>
                    <span style="color: red" id="msg">&nbsp</span><br>
                    <input id="username" name="username" type="text" class="loginuser"/></li>
                <li><input id="password" name="password" type="password" class="loginpwd"/></li>
                <li><input id="loginSub" class="loginbtn" style="text-align: center;" value="登录"/>
                    <label><input name="" type="checkbox" value="" checked="checked"/>记住密码</label><label><a href="#">忘记密码？</a></label>
                </li>
            </ul>
        </form>

    </div>

</div>


<div class="loginbm">版权所有 2013 .com 仅供学习交流，勿用于任何商业用途</div>
</body>
</html>
<script type="text/javascript">
    $("#loginSub").click(function () {
        //获取输入的手机号与输入的验证码
        var username = $("#username").val();
        var password = $("#password").val();
        //验证码的非空校验
        if (username == null || username == "") {
            $("#msg").text("账号不能为空");
            $("#username").focus();
        }
        else if (password == null || password == "") {
            $("#msg").text("密码不能为空");
            $("#password").focus();
        } else {
            $.ajax({
                url: "login",
                type: "post",
                data: {"username": username, "password": password, "func": "login"},
                dataType: "text",
                success: function (isSuccess) {
                    // alert(isSuccess);
                    if ("true" == isSuccess) {
                        //登录成功跳转小米商城首页面
                        // alert("登录成功");
                        window.location.href = "main.jsp";
                    } else {
                        $("#msg").text("账号或密码错误！").css("color", "red");
                        // $("#password").focus();
                    }
                }
            })
        }
    })
</script>